package top.lixunda.commerce.common.core.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import top.lixunda.commerce.common.core.controller.wrapper.BaseDataQuerySqlWrapper;
import top.lixunda.commerce.common.core.controller.wrapper.BaseDataUpdateSqlWrapper;
import top.lixunda.commerce.common.core.controller.wrapper.EntityUpdateWrapper;
import top.lixunda.commerce.common.core.controller.wrapper.PageWrapper;
import top.lixunda.commerce.common.core.entity.MessageObject;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author LiXunda
 * @version time:2019/10/18 11:43
 */
@Slf4j
public abstract class AbstractBaseControllerFallbackFactory<E> extends BaseThrowableHandler
        implements IController<E> {

    private final Map<Long, Throwable> map = new ConcurrentHashMap<>();

    @Override
    public Throwable getThrowable() {
        log.debug("get Throwable Thread id : " + Thread.currentThread().getId());
        return map.get(Thread.currentThread().getId());
    }

    public void putThrowable(Throwable throwable) {
        log.debug("put Throwable Thread id : " + Thread.currentThread().getId());
        map.put(Thread.currentThread().getId(), throwable);
    }

    @Override
    public MessageObject<Boolean> save(E entity) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveBatch(List<E> entityList, int batchSize) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveBatch(List<E> entityList) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveOrUpdate(E entity) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveOrUpdate(EntityUpdateWrapper<E> entityUpdateWrapper) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveOrUpdateBatch(List<E> entityList, int batchSize) {
        return null;
    }

    @Override
    public MessageObject<Boolean> saveOrUpdateBatch(List<E> entityList) {
        return null;
    }

    @Override
    public MessageObject<Boolean> removeById(String id) {
        return null;
    }

    @Override
    public MessageObject<Boolean> removeByMap(Map<String, Object> columnMap) {
        return null;
    }

    @Override
    public MessageObject<Boolean> remove(BaseDataUpdateSqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<Boolean> removeByIds(List<String> idList) {
        return null;
    }

    @Override
    public MessageObject<Boolean> updateById(E entity) {
        return null;
    }

    @Override
    public MessageObject<Boolean> update(EntityUpdateWrapper<E> entityUpdateWrapper) {
        return null;
    }

    @Override
    public MessageObject<Boolean> update(BaseDataUpdateSqlWrapper<E> updateWrapper) {
        return null;
    }

    @Override
    public MessageObject<Boolean> updateBatchById(List<E> entityList, int batchSize) {
        return null;
    }

    @Override
    public MessageObject<Boolean> updateBatchById(List<E> entityList) {
        return null;
    }

    @Override
    public MessageObject<E> getById(String id) {
        return null;
    }

    @Override
    public MessageObject<List<E>> listByIds(List<String> idList) {
        return null;
    }

    @Override
    public MessageObject<List<E>> listByMap(Map<String, Object> columnMap) {
        return null;
    }

    @Override
    public MessageObject<E> getOne(BaseDataQuerySqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<Map<String, Object>> getMap(BaseDataQuerySqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<Integer> count(BaseDataQuerySqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<Integer> count() {
        log.debug("DefaultBaseControllerFallbackFactory count()");
        return MessageObject.error(getThrowable().getMessage(), 0);
    }

    @Override
    public MessageObject<List<E>> list(BaseDataQuerySqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<List<E>> list() {
        return null;
    }

    @Override
    public MessageObject<Page<E>> page(PageWrapper<E> pageWrapper) {
        return null;
    }

    @Override
    public MessageObject<Page<E>> page(Page<E> page) {
        return null;
    }

    @Override
    public MessageObject<Page<E>> page(BaseDataQuerySqlWrapper<E> querySqlWrapper) {
        return null;
    }

    @Override
    public MessageObject<Page<Map<String, Object>>> pageMaps(Page<E> page) {
        return null;
    }

    @Override
    public MessageObject<Page<Map<String, Object>>> pageMaps(PageWrapper<E> pageWrapper) {
        return null;
    }

    @Override
    public MessageObject<List<Map<String, Object>>> listMaps(BaseDataQuerySqlWrapper<E> queryWrapper) {
        return null;
    }

    @Override
    public MessageObject<List<Map<String, Object>>> listMaps() {
        return null;
    }
}
